using System.ComponentModel.DataAnnotations;

namespace KnowledgeQA.Models.Entities
{
    /// <summary>
    /// 分类实体类
    /// </summary>
    public class Category : BaseEntity
    {
        /// <summary>
        /// 分类名称
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 分类描述
        /// </summary>
        [MaxLength(500)]
        public string? Description { get; set; }

        /// <summary>
        /// 父分类ID（支持多级分类）
        /// </summary>
        public int? ParentId { get; set; }

        /// <summary>
        /// 父分类
        /// </summary>
        public virtual Category? Parent { get; set; }

        /// <summary>
        /// 子分类列表
        /// </summary>
        public virtual ICollection<Category> Children { get; set; } = new List<Category>();

        /// <summary>
        /// 分类图标
        /// </summary>
        [MaxLength(100)]
        public string? Icon { get; set; }

        /// <summary>
        /// 分类颜色
        /// </summary>
        [MaxLength(20)]
        public string? Color { get; set; }

        /// <summary>
        /// 排序序号
        /// </summary>
        public int SortOrder { get; set; } = 0;

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnabled { get; set; } = true;

        /// <summary>
        /// 文档列表
        /// </summary>
        public virtual ICollection<Document> Documents { get; set; } = new List<Document>();
    }
} 